//
// Created by Ge on 2024/3/6.
//

#ifndef INC_3DMODEL_MESH_H
#define INC_3DMODEL_MESH_H
#include "../glm/glm.hpp"
#include "DataModel.h"
#include <vector>

class Mesh {
public:
    std::vector <Vertex> vertices;
    std::vector<unsigned int> indices;
    std::vector <Texture> textures;
    unsigned int VAO;
    /*  Functions  */
    // 构造函数，主要是初始化mesh
    Mesh(std::vector <Vertex> vertices, std::vector<unsigned int> indices, std::vector <Texture> textures) {
        this->vertices = vertices;
        this->indices = indices;
        this->textures = textures;

        // now that we have all the required data, set the vertex buffers and its attribute pointers.
        setupMesh();
    }

    // 渲染函数
    void draw(/*Shader shader*/);

    void destroy();

private:
    /*  Render data  */
    unsigned int VBO, EBO;

    /*  Functions    */
    // initializes all the buffer objects/arrays
    void setupMesh();
};

#endif //INC_3DMODEL_MESH_H
